home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / toolbar / statusrk / status.bas next >
Encoding:
BASIC Source File  |  1995-03-07  |  1.8 KB  |  47 lines

  1.  
  2. Sub DisplayStatusWindow (WindowText As String)
  3.     'Displays a bar graph during lengthy processes where an
  4.     'hourglass mouse pointer would not be appropriate
  5.     
  6.     frmStatusDisplay.Show
  7.     frmStatusDisplay.Caption = WindowText
  8. End Sub
  9.  
  10. Sub RemoveStatusWindow ()
  11.       'Removes progress bar graph.  This is done automatically
  12.       'during updates when Progress reaches 100%.
  13.  
  14.     Unload frmStatusDisplay
  15. End Sub
  16.  
  17. Sub UpdateStatusWindow (Progress As Single)
  18.     'Updates progress bar graph using Progress as a
  19.     'completion percentage.  Window closes when Progress
  20.     'reaches 100%.
  21.     'USAGE NOTES:
  22.     '   Typically, this sub will be called by dividing two numbers
  23.     '   and multiplying the results by 100.  For example:
  24.     '           UpdateStatusWindow(ItemsProcessed/TotalItems*100)
  25.     '   As a general rule, DO NOT multiply by 100 prior to the
  26.     '   division like this:
  27.     '           UpdateStatusWindow(100*ItemsProcessed/TotalItems)
  28.     '   because if ItemsProcessed were defined as an integer, any value
  29.     '   of ItemsProcessed greater than 327 will result in an intermediate
  30.     '   result of a value greater than 32767, which is the maximum value
  31.     '   for an integer.  This will probably cause the program to halt
  32.     '   execution due to an overflow condition.   
  33.     '   Developed by Jeff Trader, submitted by Rob Kraft 
  34.     '   Send comments, questions, suggestions to RobKraft@aol.com
  35.     '   This code is provided FREE   please distribute
  36.  
  37.     If Progress < 100 Then
  38.         'prevent window thrashing, only change status when change > 2%
  39.         If Progress - 2 > frmStatusDisplay.pnlStatusDisplay.FloodPercent Then
  40.             frmStatusDisplay.pnlStatusDisplay.FloodPercent = Progress
  41.         End If
  42.     Else
  43.         RemoveStatusWindow
  44.     End If
  45. End Sub
  46.  
  47.